package com.projectName.www.util;

public class String_util {
    //判断是否为空
    public static boolean isEmpty(String str) {
        if (str == null || "".equals(str.trim())) {
            return true;
            //trim去空格
        } else return false;
    }

    public static int  num(String str)
    {
        str.trim();
        int  sum=0;
        char[] chars = str.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] < 48 || chars[i] > 57)
                return 0;
            else {
                sum = (int) (sum + ( chars[i]-48)*Math.pow(10, chars.length - i - 1));
            }
        }
        return sum;
    }
}
